<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>智能代码生成器</title>
<!-- 设置网页图标 -->
<link rel="shortcut icon" href="../images/favicon.png" type="image/x-icon" />
<!-- 引入CSS -->
<link rel="stylesheet" href="../layui/css/layui.css">
<link rel="stylesheet" href="../css/mystyle.css">
<!-- 引入JS -->
<script src="../layui/layui.js"></script>
<script type="text/javascript">
layui.use(function() {
	var $ = layui.jquery;
	/* 注册菜单点击事件 */
	$(".layui-nav-child").delegate("a", "click", function(e) {
		e.preventDefault();
		$("#iframe-main").attr("src", $(this).attr("href"));
	});
	/* 加载默认数据源 */
	$.ajax({
		type : "GET",
		url : "/db/configs?page=1&rows=500",
		async : true,
		dataType : "json",
		success : function(data) {
			/* 返回成功处理数据 */
			if (data.code == 200) {
				$.each(data.data.rows, function(idx, row) {
					$("#dl-databases").append("<dd><a href='/html/tables?time="+Math.random()+"#/id=" + row.id + "/schema="+row.schema+"'>"+ row.dbName + "</a></dd>");
				});
				/* 一定初始化一次不然事件会失效 */
				layui.element.init();
			} else {
				$("#dl-databases").append("<dd><a style='color:orange;'>未找到数据源</a></dd>");
			}
		}
	});
})
</script>
</head>
<body>
  <div class="layui-layout layui-layout-admin">
    <!-- 头部模块 -->
    <div class="layui-header">
      <div class="layui-logo">
        <img src="../images/logo.svg" class="layui-nav-img"/><b class="logo-text" style="font-family:STXingkai;font-size: 26px;">代码生成工具</b>
      </div>
      <ul class="layui-layout-right" style="margin: 16px;">
        <li class="layui-nav-item bounce">
            <span class="letter">始</span>
            <span class="letter">终</span>
            <span class="letter">要</span>
            <span class="letter">相</span>
            <span class="letter">信</span>
            <span class="letter">，</span>
            <span class="letter">努</span>
            <span class="letter">力</span>
            <span class="letter">就</span>
            <span class="letter">会</span>
            <span class="letter">有</span>
            <span class="letter">收</span>
            <span class="letter">获</span>
        </li>
      </ul>
    </div>
    <!-- 左侧导航区域-->
    <div class="layui-side layui-bg-black">
      <div class="layui-side-scroll">
        <ul id="nav" class="layui-nav layui-nav-tree" lay-filter="test">
          <li class="layui-nav-item layui-nav-itemed"><a href="javascript:;"><i class="layui-icon layui-icon-template"></i>&nbsp;配置管理</a>
            <dl class="layui-nav-child">
              <dd class="layui-this">
                <a href="/html/databases">数据源配置</a>
              </dd>
              <dd>
                <a href="/html/templatesets">类模板配置</a>
              </dd>
            </dl></li>
          <li class="layui-nav-item layui-nav-itemed"><a href="javascript:;"><i class="layui-icon layui-icon-component"></i>&nbsp;数据库列表</a>
            <dl id="dl-databases" class="layui-nav-child">
            </dl></li>
        </ul>
      </div>
    </div>
    <!-- 内容主体区域 -->
    <div class="layui-body">
      <!-- 内容主体区域 -->
      <div style="width: 100%; height: 100%;">
        <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes" width="100%" height="100%" id="iframe-main" src="/html/databases"></iframe>
      </div>
    </div>
    <!-- 底部固定区域 -->
    <div class="layui-footer">
      <center><p class="logo-text">了解更多产品请拨打 191****3251 | 邮箱地址：mrliugangqiang@outlook.com</p></center>
    </div>
  </div>
</body>
</html>